package com.inossem.warehousestorage_inossem.request.receive;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.utils.encryption.URLUtils;
import com.inossem.warehousestorage_inossem.bean.receive.ReceiveDeliveryOverviewBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * Created by leij on 2017/6/13.
 */

public class ReceiveDeliveryOverviewRequest extends Request {
    public static String request(Context context, String deliveryNumber, GsonBeanListener gsonBeanListener) {
        String tag;
        String url = RequestManage.getUrl(context,RequestConstant.URL_RECEIVE_DELIVERY_OVERVIEW + URLUtils.encode(deliveryNumber));
        tag = RequestManage.getHttpsGetWithLoading(context, url, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                ReceiveDeliveryOverviewBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), ReceiveDeliveryOverviewBean.class);
                excuteJsonBean(context, bean, bean.getCode(), bean.getMsg(), gsonBeanListener);
            }
        });
        return tag;
    }

}
